package me.chan.chatting.server.service;

import io.netty.channel.Channel;

public interface SessionService {

    /**
     * bind channel to session
     * @param channel which channel need to bind session
     * @param username
     */
    void bind(Channel channel, String username);

    /**
     * unbind the channel from session
     * @param channel the channel to unbind
     */
    void unbind(Channel channel);

    /**
     * @param channel
     * @param name
     * @return
     */
    Object getAttribute(Channel channel, String name);

    /**
     * @param channel
     * @param name
     * @param value
     */
    void setAttribute(Channel channel, String name, Object value);

    /**
     * get channel via username
     * @param username username
     * @return channel
     */
    Channel getChannel(String username);
}
